home *** CD-ROM | disk | FTP | other *** search
/ Software Vault: The Gold Collection / Software Vault - The Gold Collection (American Databankers) (1993).ISO / cdr48 / qwrit11.zip / QWDEMO.PAS next >
Pascal/Delphi Source File  |  1993-04-16  |  5KB  |  126 lines

  1.  
  2.  {$A+,B-,D-,E-,F-,I+,N-,O-,R-,S-,V+}
  3.  {$M 1024, 0,0}
  4.  
  5. program TestQwriterUnit;
  6. uses
  7.   Qwriter;
  8.  
  9. var
  10.   Loop1,           (* Loop control variables.                               *)
  11.   Loop2,
  12.   KeyChoice : word; (* User's key choice variable.                          *)
  13.  
  14. BEGIN
  15.                    (* If we're in a color text-mode then...                 *)
  16.   if ColorMode then
  17.     ClearScr($27)
  18.  
  19.                    (* Else, we're in a monochrome text-mode.                *)
  20.   else
  21.     ClearScr(RevAttr);
  22.  
  23.                    (* Hide the cursor.                                      *)
  24.   HideCursor(true);
  25.  
  26.                    (* Draw a menu on the screen.                            *)
  27.   Qwrite('╔════════════════════════════════╗', 24, 6, RevAttr);
  28.   Qwrite('║      MENU CHOICE NUMBER 1      ║', 24, 7, RevAttr);
  29.   Qwrite('║      MENU CHOICE NUMBER 2      ║', 24, 8, RevAttr);
  30.   Qwrite('║      MENU CHOICE NUMBER 3      ║', 24, 9, RevAttr);
  31.   Qwrite('║      MENU CHOICE NUMBER 4      ║', 24,10, RevAttr);
  32.   Qwrite('║      MENU CHOICE NUMBER 5      ║', 24,11, RevAttr);
  33.   Qwrite('║             EXIT               ║', 24,12, RevAttr);
  34.   Qwrite('╚════════════════════════════════╝', 24,13, RevAttr);
  35.   Qwrite(' Use cursor-arrow keys to make your choice, then press <ENTER> ',
  36.          10, 15, RevAttr);
  37.  
  38.                    (* Get the User's menu choice.                           *)
  39.   KeyChoice := PickIt(7, 12, 25, 32, RevAttr, NormAttr);
  40.  
  41.                    (* Display the User's menu choice.                       *)
  42.   Qwrite(' Your KeyChoice = ' + Int2Str(KeyChoice, 2) + ' ', 30, 18, RevAttr);
  43.  
  44.                    (* Prompt to continue this demo.                         *)
  45.   Qwrite(' Press <ESC> key to continue demo ', 24, 20, RevAttr);
  46.  
  47.                    (* Wait until the User presses the <ESC> key.            *)
  48.   Pause(EscapeKey);
  49.  
  50.                    (* Clear the screen using the pre-set normal attribute.  *)
  51.   ClearScr(NormAttr);
  52.  
  53.                    (* Check if we're in color mode again.                   *)
  54.   if NOT ColorMode then
  55.  
  56.                    (* Bzzzzzzzzttt!  We're in monochrome mode.              *)
  57.     begin
  58.  
  59.                    (* Explain why the program is halting.                   *)
  60.       Qwrite(' THIS SECTION NEEDS TO BE IN COLOR ', 23, 3, RevAttr);
  61.  
  62.                    (* Prompt for a key press.                               *)
  63.       Qwrite(' Press <ESC> key to quit ', 28, 5, RevAttr);
  64.  
  65.                    (* Wait until the <ESC> key is pressed.                  *)
  66.       Pause(EscapeKey);
  67.  
  68.                    (* Show the cursor again.                                *)
  69.       HideCursor(false);
  70.  
  71.                    (* Clear the screen with the preset normal attribute.    *)
  72.       ClearScr(NormAttr);
  73.  
  74.                    (* Halt the program.                                     *)
  75.       halt
  76.     end
  77.  
  78.                    (* Else, Yes!!!  We're in a color text-mode.             *)
  79.   else
  80.     begin
  81.                    (* Clear the screen to lightgray.                        *)
  82.       ClearScr($70);
  83.  
  84.                    (* Draw the "color attribute" chart.                     *)
  85.       VQwrite('                ', 14, 8, NormAttr);
  86.       VQwrite('0123456789ABCDEF', 15, 8, $0F);
  87.       VQwrite('                ', 16, 8, NormAttr);
  88.       VQwrite('            ', 10, 10, NormAttr);
  89.       VQwrite('FIRST NUMBER', 11, 10, NormAttr);
  90.       VQwrite('            ', 12, 10, NormAttr);
  91.       Qwrite(' HEXIDECIMAL TEXT ATTRIBUTE CHART ', 25, 2, $0F);
  92.       Qwrite('SECOND NUMBER', 36, 4, NormAttr);
  93.       Qwrite(' 0  1  2  3  4  5  6  7  8  9  A  B  C  D  E  F ', 19, 6, $0F);
  94.       for Loop1 := 0 to 15 do
  95.         for Loop2 := 0 to 15 do
  96.           Qwrite(' X ', (19 + (Loop2 * 3)), (8 + Loop1),
  97.                  (Loop2 + (Loop1 Shl 4)));
  98.  
  99.                    (* Display User prompt.                                  *)
  100.       Qwrite(' PRESS <ENTER> KEY TO TURN BLINK-BIT OFF ', 22, 25, NormAttr);
  101.  
  102.                    (* Wait until the <ENTER> key is pressed.                *)
  103.       Pause(EnterKey);
  104.  
  105.                    (* Turn the color video blink-bit off, to display more   *)
  106.                    (* colors.                                               *)
  107.       BlinkBit(Off);
  108.  
  109.                    (* Display prompt.                                       *)
  110.       Qwrite('     PRESS <ESC> KEY TO QUIT PROGRAM     ', 22, 25, NormAttr);
  111.  
  112.                    (* Wait until <ESC> key is pressed.                      *)
  113.       Pause(EscapeKey);
  114.  
  115.                    (* Turn the blink-bit back on.                           *)
  116.       BlinkBit(On);
  117.  
  118.                    (* Show the cursor again.                                *)
  119.       HideCursor(Off);
  120.  
  121.                    (* Clear the screen.                                     *)
  122.       ClearScr($07)
  123.     end
  124. END.
  125.  
  126.